using System.Reflection;
using System;
using MAPI;
using SharePoint.ImportExport.Core;

namespace Exchange.Export.DataHandler
{
	/// <summary>
	/// Summary description for FieldsHelper.
	/// </summary>
	public class FieldsHelper
	{
		private MAPI.Fields oFields;
		public FieldsHelper(MAPI.Fields Fields)
		{
			oFields=Fields;
		}
		public MAPI.Field GetField(uint Prop, object PropSet)
		{
			MAPI.Field oField=null;
			try
			{
				oField=(MAPI.Field)oFields.get_Item(Prop,PropSet);
			}
			catch(System.Runtime.InteropServices.COMException Ex)
			{
				oField = null;
				string s=Ex.Message;
			}
			return oField;

		}
		public MAPI.Field GetField(string PropValue)
		{
			MAPI.Field oField=null;
			try
			{
				object vEmpty = Missing.Value;

				oField=(MAPI.Field)oFields.get_Item((object)PropValue,vEmpty);
			}
			catch(System.Runtime.InteropServices.COMException Ex)
			{
				oField = null;
				string s=Ex.Message;
			}
			return oField;

		}
	}
}
